package com.zy.chapter8

/**
 * @author: zhaoyi
 * @create: 2020-08-02 18:14
 * @description: 只有主构造器可以调用超类的主构造器
 **/
class Employee(name: String, deptId: Int) extends Person(name) {

  var comId: Int = _

  def this(name: String, deptId: Int, comId: Int) {
    this(name, deptId)
    this.comId = comId
    this.age = 18
  }

  //重写父类 （非抽象方法） 必须要加 override
  override def getAge: Int = {
    println(" override Person getAge")
    age
  }

}
